import request from '@/utils/request'

// 查询串口列表
export function listSerial(query) {
  return request({
    url: '/device/serial/list',
    method: 'get',
    params: query
  })
}

// 查询串口详细
export function getSerial(id) {
  return request({
    url: '/device/serial/' + id,
    method: 'get'
  })
}

// 新增串口
export function addSerial(data) {
  return request({
    url: '/device/serial',
    method: 'post',
    data: data
  })
}

// 修改串口
export function updateSerial(data) {
  return request({
    url: '/device/serial',
    method: 'put',
    data: data
  })
}

// 删除串口
export function delSerial(id) {
  return request({
    url: '/device/serial/' + id,
    method: 'delete'
  })
}

// 查询串口已绑定设备类型
export function getAuthDeviceType(serialId) {
  return request({
    url: '/device/serialTypeRef/authDeviceType/' + serialId,
    method: 'get'
  })
}

// 保存串口已绑定设备类型
export function updateAuthDeviceType(data) {
  return request({
    url: '/device/serialTypeRef/authDeviceType',
    method: 'put',
    params: data
  })
}

// 查询串口已绑定设备类型
export function getAuthDataCheck(serialId) {
  return request({
    url: '/device/serialCheckRef/authDataCheck/' + serialId,
    method: 'get'
  })
}

// 保存串口已绑定设备类型
export function updateAuthDataCheck(data) {
  return request({
    url: '/device/serialCheckRef/authDataCheck',
    method: 'put',
    params: data
  })
}
//修改采集状态
export function editGather(id,status) {
  return request({
    url: '/device/serial/editGather/'+id+'/'+status,
    method: 'put',
  })
}

// 保存串口下发命令
export function chooseCommand(data) {
  return request({
    url: '/device/commandLog',
    method: 'post',
    data: data
  })
}

// 查询列表
export function getListCommand(query) {
  return request({
    url: '/device/command/list',
    method: 'get',
    params: query
  })
}